package dev.alm.functioncalltooldemo.controller;

import dev.alm.functioncalltooldemo.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("llm")
public class LLMController {

    @Autowired
    private ChatService chatService;

    @GetMapping("chat")
    public String chat(@RequestParam(value = "message", defaultValue = "你是谁？") String message) {
        return chatService.chat(message);
    }

    @GetMapping("stream")
    public Flux<String> stream(@RequestParam(value = "message", defaultValue = "你是谁？") String message) {
        return chatService.stream(message);
    }

}
